<%@ include file="/include/taglib.jsp"%>

<c:set var="itemLevel" value="1" scope="request"/>
<c:forEach var="item" items="${form.items}">	
	<c:choose>
		<c:when test="${item.class.name == 'org.computate.form.item.FormGroup'}">
			<c:set var="item" value="${item}" scope="request"/>
			<jsp:include page="/fragment/FormItem.jsp"/>
		</c:when>
		<c:when test="${item.class.name == 'org.computate.form.item.FormField' or item.class.name == 'org.computate.form.item.FormParagraph'}">
			<c:choose>
				<c:when test="${item.c.name == 'java.lang.Boolean' or item.c.name == 'boolean'}">
					<c:set var="dataType" value="horizontal" scope="request"/>
				</c:when>
				<c:otherwise>
					<c:set var="dataType" value="" scope="request"/>
				</c:otherwise>
			</c:choose>
			<div data-role="fieldcontain">
				<fieldset data-role="controlgroup" data-type="${dataType}">
					<legend>${fn:escapeXml(item.label)}</legend>
					<c:set var="item" value="${item}" scope="request"/>
					<jsp:include page="/fragment/FormItem.jsp"/>
				</fieldset>
			</div>
		</c:when>
	</c:choose>
</c:forEach>
